import { login, forgetPassword, logout, getInfo } from '@/api/user'
import { getToken, setToken, removeToken } from '@/utils/auth'
import { resetRouter } from '@/router'
import Cookies from 'js- cookie'

const state = {
  clogCompetitionList: [],
  clogEventList: [],
  clogGradeList: []
}

const mutations = {
  clogCompetitionLst: (state, info) => {
    state.clogCompetitionLst = info
  },
  clogEventList: (state, info) => {
    state.clogEventList = info
  },
  clogGradeList: (state, info) => {
    state.clogGradeList = info
  }
}
const actions = {
  // clogGradeList
  clogCompetitionList({ commit }, userInfo) {
    const { list, result } = userInfo
    return new Promise((resolve, reject) => {
      this({ list: list.trim(), result }).then(response => {
        const data = response
        commit('clogCompetitionList', data.result.token)
        setToken(data.result.token)
        resolve()
      }).catch(error => {
        reject(error)
      })
    })
  },
  // clogGradeList
  clogEventList({ commit }, userInfo) {

  },
  // clogGradeList info
  clogGradeList({ commit, state }) {

  }

}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
